package com.qqtech.qquan.coupon.dao;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import com.qqtech.core.frame.dao.BaseDao;
import com.qqtech.qquan.coupon.model.CouponUser;
import com.qqtech.qquan.coupon.model.CouponUserQuery;
import com.qqtech.qquan.coupon.model.CouponUserVo;

public interface CouponUserDao extends BaseDao<CouponUser> {
	/**
	 *	有效期内满多少减多少最大金额的优惠卷
	 */
	CouponUserVo getMaxFullPriceMinusPrice(CouponUserQuery couponUserQuery);
	/**
	 * 调度自动过期
	 */
	void autoExpire();
	/**
	 * leftBase表查询
	 * @param couponNo
	 * @return
	 */
	List<CouponUserVo> getLeftBase(CouponUserQuery couponUserQuery);
	
	/**
	 * 根据couponNo获取用户的有优惠卷
	 * @param couponNo
	 * @return
	 */
	CouponUserVo getBaseByCouponNo(String couponNo);
	
	/**
	 * 根据couponNo更新用户优惠卷状态
	 * @param couponNo
	 */
	int updateByCouponNo(CouponUser couponUser);
	public Integer queryUnusedCount(CouponUser couponUser);
	/**
	 * 后台查询记录数
	 * @param query
	 * @return
	 */
	public int queryCountAdmin(CouponUser query);
	
	/**
	 * 后台查询 -分页
	 * @param query
	 * @param pageable
	 * @return
	 */
	public Page<CouponUserVo> queryPageListAdmin(CouponUser query, Pageable pageable);
	
	/**
	 * 后台查询 -不分页
	 * @param query
	 * @param pageable
	 * @return
	 */
	public List<CouponUserVo> queryListAdmin(CouponUser query, Pageable pageable);
	/**
	 * 统计优惠劵用户数量（不重复的）
	 * @param query
	 * @return
	 */
	int queryCount4UserNoRepeat(CouponUser query);

	/**
	 * 查询用户优惠卷
	 * @param query
	 * @return
	 */
	Integer queryCountByUserId(CouponUser query);

	List<CouponUserVo> queryCountByUserIds(CouponUserQuery couponUserQuery);
}
